
#main

str = '\'abc123\'';
match_count = preg_match(/^\\'[a-z0-9]+\'$/i, str)
echo match_count  // 0 or 1

regex = /[\s\|,]/
result0 = regex.match('ab cd|e,f') // result: [' ']
var_dump(result0)

result1 = regex.matches('ab cd|e,f') // result: [' ', '|', ',']
var_dump(result1)

// disincludes the separators
result2 = regex.split('ab cd|e,f') // result: ['ab', 'cd', 'e', 'f']
var_dump(result2)

// includes the separators
result3 = /([\s\|,])/.separate('ab cd|e,f') // result: ['ab', ' ', 'cd', '|', 'e', ',', 'f']
var_dump(result3)
